package com.zsrd.lessons.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zsrd.lessons.domain.TsExam;
import com.zsrd.lessons.domain.vo.ExamVo;
import com.zsrd.lessons.mapper.TsExamMapper;
import com.zsrd.lessons.service.TsExamService;
import com.zsrd.lessons.utils.ListUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 试卷表 服务实现类
 * </p>
 *
 * @author Chen Wei
 * @since 2022-07-11
 */
@Service
public class TsExamServiceImpl extends ServiceImpl<TsExamMapper, TsExam> implements TsExamService {

    @Override
    public ExamVo queryBeStartExam(String orgNo, String loginId) {
        List<ExamVo> e = this.baseMapper.queryBeStartExam(orgNo,loginId);
        if(ListUtils.isEmpty(e)){
            ExamVo examVo = new ExamVo();
            examVo.setIsTodayExam(0);
            return examVo;
        }
        ExamVo examVo = e.get(0);
        examVo.setIsTodayExam(1);
        return examVo;
    }
}
